package com.wqr.service;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.wqr.dao.PasswordInfoDao;
import com.wqr.pojo.PasswordInfo;
import com.wqr.pojo.PasswordInfoExample;

@Service
public class PasswordInfoServiceImp implements PasswordInfoService {
	@Autowired
	public PasswordInfoDao passwordInfoDao;
	
	public List<PasswordInfo> list() throws Exception {
		PasswordInfoExample example = new PasswordInfoExample();
		List<PasswordInfo> list = passwordInfoDao.selectByExample(example);
		return list;
	}

	public int delectPasswordInfo(Integer passwordInfoId) throws Exception {
		int a = passwordInfoDao.deleteByPrimaryKey(passwordInfoId);
		if(a > 0) {
			return 1;
		}else {
			return 0;
		}
	}
	public int insertPasswordInfo(PasswordInfo passwordInfo) throws Exception {
		int a = passwordInfoDao.insertSelective(passwordInfo);
		if(a > 0) {
			return 1;
		}else {
			return 0;
		}
	}
	public int updatePasswordInfo(PasswordInfo passwordInfo) throws Exception {
		int a = passwordInfoDao.updateByPrimaryKey(passwordInfo);
		if(a > 0) {
			return 1;
		}else {
			return 0;
		}
	}

	public List<PasswordInfo> selectPasswordInfo(PasswordInfo passwordInfo) throws Exception {
		List<PasswordInfo> list = passwordInfoDao.selectByWhere(passwordInfo);
		return list;
	}

	public List<PasswordInfo> selectByPrimaryKey(Integer passwordInfoId) throws Exception {
		@SuppressWarnings("unchecked")
		List<PasswordInfo> list = (List<PasswordInfo>) passwordInfoDao.selectByPrimaryKey(passwordInfoId);
		return list;
	}
}
